import axios,{ url } from '.';
//渲染
export const getAll=async (data)=>{
    // console.log("111",data);
    let res=await axios({
        method:"get",
        url:url+'/users',
        params:data
    });
    return res.data
}
//增加
export const add=async (data)=>{
    let res=await axios({
        method:"post",
        url:url+'/users',
        data
    });
    return res.data
}
//删除
export const del=async (id)=>{
    console.log(id);
    let res=await axios({
        method:"delete",
        url:url+'/users/'+id,
    });
    return res.data
}
//冻结frozen
export const frozen=async (id,state)=>{
    console.log(id,state);
    let res=await axios({
        method:"put",
        url:url+'/users/frozen/'+id,
        data:{state:state}
    });
    return res.data
}
//id查询
export const put =async (id)=>{
    console.log(id);
    let res=await axios({
        method:"get",
        url:url+'/users/'+id,
    });
    return res.data
}
//修改
export const put1 =async (data)=>{
    console.log(data);
    let res=await axios({
        method:"put",
        url:url+'/users/'+data._id,
        data
    });
    return res.data
}

